<%@ LANGUAGE="VBSCRIPT" %>
<% option explicit%>
<% Response.Expires=0 %>
<%
dim aa, bb
aa=Request.ServerVariables("LOGON_USER")
bb=Request.Querystring("AN")
if instr(1,aa, bb,1)=0 THEN
response.clear
response.end
end if

aa=Request.ServerVariables("HTTP_USER_AGENT")
bb="Indy"
if instr(1,aa, bb,1)=0 THEN
response.clear
response.end
end if
%>
<!--METADATA NAME="Microsoft ActiveX Data Objects 2.5 Library" TYPE="TypeLib" UUID="{00000205-0000-0010-8000-00AA006D2EA4}"-->
<%
dim Node, Sum, Description, CN, DTA, Ph, BN,MBN, RN,MRN, BS,AV,CV,WV,Audv,Iv 
dim Rl, Rv, f1, f2, f3, f4, f5, ff, prf,prs, addr1, TH, Total, Today, Last
dim Bv, Pv, Qv, Mv, Ptv, Pav, Plv
Node=request("Node")
if isEmpty(Node) then Node="_P"
CN=request("CN")
if isEmpty(CN) then CN=""
DTA=request("DTA")
if isEmpty(DTA) then DTA=""
BN=request("BN")
if isEmpty(BN) then BN=""
BS=request("BS")
if isEmpty(BS) then BS=""
MBN=request("MBN")
if isEmpty(MBN) then MBN=""

RN=request("RN")
if isEmpty(RN) then RN=""
if Len(RN)>4 then RN="9999"

MRN=request("MRN")
if isEmpty(MRN) then MRN=""
Av=request("Av")
if isEmpty(Av) then Av=""
Cv=request("Cv")
if isEmpty(Cv) then Cv=""
Wv=request("Wv")
if isEmpty(Wv) then Wv=""
AudV=request("AudV")
if isEmpty(AudV) then AudV=""
Iv=request("Iv")
if isEmpty(Iv) then Iv=""
Rv=request("Rv")
if isEmpty(Rv) then Rv=""

Bv=request("Bv")
if isEmpty(Bv) then Bv=""
Pv=request("Pv")
if isEmpty(Pv) then Pv=""
Qv=request("Qv")
if isEmpty(Qv) then Qv=""
Mv=request("Mv")
if isEmpty(Mv) then Mv=""
Ptv=request("Ptv")
if isEmpty(Ptv) then Ptv=""
Pav=request("Pav")
if isEmpty(Pav) then Pav=""
Plv=request("Plv")
if isEmpty(Plv) then Plv=""


RL=request("RL")
if isEmpty(RL) then RL=""
F1=request("F1")
if isEmpty(F1) then f1=""
F2=request("F2")
if isEmpty(F2) then f2=""
F3=request("F3")
if isEmpty(F3) then f3=""
F4=request("F4")
if isEmpty(F4) then f4=""
F5=request("F5")
if isEmpty(F5) then f5=""
Ff=request("Ff")
if isEmpty(Ff) then ff=""
prf=request("prf")
if isEmpty(prf) then prf=""
prs=request("prs")
if isEmpty(prs) then prs=""
addr1=request("addr1")
if isEmpty(addr1) then addr1=""
TH=request("th")
if isEmpty(th) then TH=0
Total=request("Total")
if isEmpty(Total) then Total=0
Today=request("Today")
if isEmpty(Today) then Today=0
Last=request("Last")
if isEmpty(Last) then Last=""

	Dim cnn
	Dim connStr
	dim cmd
	dim R
	Set cnn=Server.CreateObject("ADODB.Connection")
    Set cmd=Server.CreateObject("ADODB.Command")
%>
<!-- #INCLUDE FILE="Connection.inc" -->
<%
''''	connStr="Provider=SQLOLEDB.1;Persist Security Info=True;User ID=Test;Password=Test;Initial Catalog=SMS"&Node&";Data Source=EM-HOME"
	cnn.open connStr
	Set cmd.ActiveConnection = cnn
	cmd.CommandType=adCmdStoredProc
	cmd.CommandText = "sp_AutomatWatching"

	Cmd.Parameters.Append Cmd.CreateParameter("@AutomatNumber", adVarChar, adParamInput,24)
	Cmd.Parameters.Append Cmd.CreateParameter("@Code", adVarChar, adParamInput,10)
	Cmd.Parameters.Append Cmd.CreateParameter("@CN", adVarChar, adParamInput,24)
	Cmd.Parameters.Append Cmd.CreateParameter("@BN", adVarChar, adParamInput,6)
	Cmd.Parameters.Append Cmd.CreateParameter("@BS", adVarChar, adParamInput,8)
	Cmd.Parameters.Append Cmd.CreateParameter("@MBN", adVarChar, adParamInput,4)
	Cmd.Parameters.Append Cmd.CreateParameter("@RN", adVarChar, adParamInput,4)
	Cmd.Parameters.Append Cmd.CreateParameter("@MRN", adVarChar, adParamInput,8)
	Cmd.Parameters.Append Cmd.CreateParameter("@AV", adVarChar, adParamInput,16)
	Cmd.Parameters.Append Cmd.CreateParameter("@CV", adVarChar, adParamInput,16)
	Cmd.Parameters.Append Cmd.CreateParameter("@WV", adVarChar, adParamInput,16)
	Cmd.Parameters.Append Cmd.CreateParameter("@AudV", adVarChar, adParamInput,16)
	Cmd.Parameters.Append Cmd.CreateParameter("@IV", adVarChar, adParamInput,16)
	Cmd.Parameters.Append Cmd.CreateParameter("@RV", adVarChar, adParamInput,16)
	Cmd.Parameters.Append Cmd.CreateParameter("@BV", adVarChar, adParamInput,32)
	Cmd.Parameters.Append Cmd.CreateParameter("@PV", adVarChar, adParamInput,16)
	Cmd.Parameters.Append Cmd.CreateParameter("@QV", adVarChar, adParamInput,16)
	Cmd.Parameters.Append Cmd.CreateParameter("@MV", adVarChar, adParamInput,16)
	Cmd.Parameters.Append Cmd.CreateParameter("@PtV", adVarChar, adParamInput,16)
	Cmd.Parameters.Append Cmd.CreateParameter("@PaV", adVarChar, adParamInput,16)
	Cmd.Parameters.Append Cmd.CreateParameter("@PlV", adVarChar, adParamInput,16)
	Cmd.Parameters.Append Cmd.CreateParameter("@RL", adVarChar, adParamInput,6)
	Cmd.Parameters.Append Cmd.CreateParameter("@PRF", adVarChar, adParamInput,6)
	Cmd.Parameters.Append Cmd.CreateParameter("@PRS", adVarChar, adParamInput,12)
	Cmd.Parameters.Append Cmd.CreateParameter("@F1", adVarChar, adParamInput,6)
	Cmd.Parameters.Append Cmd.CreateParameter("@F2", adVarChar, adParamInput,6)
	Cmd.Parameters.Append Cmd.CreateParameter("@F3", adVarChar, adParamInput,6)
	Cmd.Parameters.Append Cmd.CreateParameter("@F4", adVarChar, adParamInput,6)
	Cmd.Parameters.Append Cmd.CreateParameter("@F5", adVarChar, adParamInput,6)
	Cmd.Parameters.Append Cmd.CreateParameter("@FF", adVarChar, adParamInput,6)
	Cmd.Parameters.Append Cmd.CreateParameter("@ADDR1", adVarChar, adParamInput,32)
	Cmd.Parameters.Append Cmd.CreateParameter("@DTA", adVarChar, adParamInput,20)
	Cmd.Parameters.Append Cmd.CreateParameter("@TH", adInteger, adParamInput)
	Cmd.Parameters.Append Cmd.CreateParameter("@Total", adInteger, adParamInput)
	Cmd.Parameters.Append Cmd.CreateParameter("@Today", adInteger, adParamInput)
	Cmd.Parameters.Append Cmd.CreateParameter("@Last", adVarChar, adParamInput,20)

	Cmd.Parameters.Append Cmd.CreateParameter("@id", adInteger, adParamOutput)
	Cmd.Parameters.Append Cmd.CreateParameter("@Res", adInteger, adParamOutput)
	Cmd.Parameters.Append Cmd.CreateParameter("@Result", adVarChar, adParamOutput,160)
	Cmd("@AutomatNumber")=Request.Querystring("AN")
	Cmd("@Code")=Request.Querystring("Cd")
	Cmd("@CN")=CN
	Cmd("@BN")=BN
	Cmd("@BS")=BS
	Cmd("@MBN")=MBN
	Cmd("@RN")=RN
	Cmd("@MRN")=MRN
	Cmd("@Av")=Av
	Cmd("@Cv")=Cv
	Cmd("@Wv")=Wv
	Cmd("@AudV")=AudV
	Cmd("@Iv")=Iv
	Cmd("@Rv")=Rv
	Cmd("@Bv")=Bv
	Cmd("@Pv")=Pv
	Cmd("@Qv")=Qv
	Cmd("@Mv")=Mv
	Cmd("@Ptv")=Ptv
	Cmd("@Pav")=Pav
	Cmd("@Plv")=Plv
	Cmd("@Rl")=Rl
	Cmd("@PRF")=PRF
	Cmd("@PRS")=PRS
	Cmd("@F1")=F1
	Cmd("@F2")=F2
	Cmd("@F3")=F3
	Cmd("@F4")=F4
	Cmd("@F5")=F5
	Cmd("@FF")=FF
	Cmd("@Addr1")=Addr1
	Cmd("@DTA")=DTA
	Cmd("@TH")=TH
	Cmd("@Total")=Total
	Cmd("@Today")=Today
	Cmd("@Last")=Last
	cmd.execute
	%>
<Result>
<%=Cmd("@Result")%>
</Result>
<%
	set cmd=nothing
	cnn.close
	set cnn=nothing
%>
